package com.net.xpay.core.manager;

import com.net.xpay.common.enums.invoice.OpenInvoiceStatus;
import com.net.common.manager.DomainManager;
import com.net.xpay.core.domain.ChargeRecord;
import com.net.xpay.core.enums.PayStatus;
import com.net.xpay.core.model.ChargeRecordSearchModel;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;


public interface ChargeRecordManager extends DomainManager<Long,ChargeRecord> {
    List<ChargeRecord> listByStatus(PayStatus status);

    List<ChargeRecord> search(ChargeRecordSearchModel searchModel);

    long searchCount(ChargeRecordSearchModel searchModel);

    /**
     * 统计充值金额
     * @param positive 1正  0负
     */
    long statChargeAmount(LocalDateTime minEndTime, LocalDateTime maxEndTime, Integer positive);

    long statAmountByAlipayAppQrcode(LocalDateTime minEndTime, LocalDateTime maxEndTime);

    long statUserAmountByAlipayAppQrcode(Long userId, LocalDateTime minEndTime, LocalDateTime maxEndTime);

    List<ChargeRecord> list(ChargeRecordSearchModel searchModel);


    ChargeRecord findLastPaid(Long userId);

    ChargeRecord getByOutBizNo(String outBizNo);
    /**
     * 统计可开票金额
     */
    Long statWaitInvoicingAmount(Long userId, LocalDateTime startTime);

    ChargeRecord findById(Long userId, Long id);
    /**
     * 更新开票关联充值记录
     */
    int updateOpenInvoiceStatusByIds(List<Long> ids, OpenInvoiceStatus status);
    /**
     * 根据ids查询充值记录
     */
    List<ChargeRecord> listByIds(List<Long> ids);
    /**
     * 根据外部订单号查询充值记录
     */
    ChargeRecord findByImportBizNo(Long userId, String importBizNo);
    /**
     * 统计当天的合伙人服务费充值金额
     */
    long sumServiceChargeFeeByDay(Long partnerId, LocalDateTime minEndTime, LocalDateTime maxEndTime);
    /**
     * 统计当天的商户服务费充值金额
     */
    long sumUserServiceChargeFeeByDay(Long userId, LocalDateTime minEndTime, LocalDateTime maxEndTime);
    /**
     * 统计当天平台服务费充值金额
     */
    long sumCompanyServiceChargeFeeByDay(LocalDateTime minEndTime, LocalDateTime maxEndTime);


}
